package com.why.websocketmqttstudy.why.websocket.handler;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

@Service
public class WebSocketMsgFactory {

    @Resource
    Map<String, WebSocketMsgHandler> handlerList;

    /**
     * 获取已经注册的Handler
     * @param component
     * @return
     * @throws Exception
     */
    public WebSocketMsgHandler getHandler(String component) throws Exception{
        if(handlerList!=null){
            WebSocketMsgHandler handler = handlerList.get(component);
            return handler;
        }

        return null;
    }
}
